package com.attendance.chdingtask.controller;


import com.attendance.chdingtask.config.WebLog;
import com.attendance.chdingtask.model.MdDevice;
import com.attendance.chdingtask.service.MdDeviceService;
import com.attendance.chdingtask.utils.common.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@Api(value = "device", description = "设备维护", consumes = "application/json;charset=UTF-8")
@RequestMapping(value = "/device")
public class DeviceController extends BaseController{

    @Autowired
    private MdDeviceService deviceService;

    @PostMapping("/add")
    @ResponseBody
    @WebLog(description = "设备维护")
    @ApiOperation(value = "设备维护", notes = "{}")
    public Result sendMessage(@RequestBody MdDevice device){
        try{
            deviceService.save(device);
        }catch (Exception e){
            return Result.error(e.getMessage());
        }
        return Result.success();
    }
}
